package memleak.test.com.testlist;


import com.gzgd.log.LogUtils;

/**
 * Created by runrun on 2017/3/2.
 */

public class VideoBean implements Cloneable {

    private String channelCategory;
    private String playUrl;
    private String channelNum;
    private String channelName;
    //private List<Epg> epgs;
    private String adUrl;
    private String videoId;
    private String templated_id;
    private String instance_id;
    private DvbBean dvb;
    private ProgramUnit presentProgram;
    private ProgramUnit followingProgram;
    private boolean isSupportTS;
    private String media_id;
    private String isVideo;  //1:视频 0:广播
    private long startPlayTime;
    private long endPlayTime;
    private String logoUrl;
    private String background;
    private long duration;
    private boolean isCanPlay;
    /**
     * 类型
     * <p>
     * 1：直播频道
     * 2：回看频道
     * 3：互动栏目
     * 4：增值业务
     * 5：安卓应用
     * 6: 自定义
     */
    private String videoType;


    public VideoBean(String channelNum, String videoId, String channelName) {
        this.channelNum = channelNum;
        this.videoId = videoId;
        this.channelName = channelName;
    }

    public VideoBean(String channelNum, String videoId, String channelName, String logoUrl) {
        this.channelNum = channelNum;
        this.videoId = videoId;
        this.channelName = channelName;
        this.logoUrl = logoUrl;
    }

    public VideoBean() {
    }

    @Override
    public VideoBean clone() {
        VideoBean o = null;
        try {
            o = (VideoBean) super.clone();
            if (o.dvb != null) {
                o.setDvb(o.dvb.clone());
            }
        } catch (CloneNotSupportedException e) {
            LogUtils.e("VideoBean", "clone error", e);
        }
        return o;
    }

    public String getPlayUrl() {
        return playUrl;
    }

    public void setPlayUrl(String playUrl) {
        this.playUrl = playUrl;
    }

    public String getChannelNum() {
        return channelNum;
    }

    public void setChannelNum(String channelNum) {
        this.channelNum = channelNum;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String title) {
        this.channelName = title;
    }

    public boolean isSupportTS() {
        return isSupportTS;
    }

    public void setSupportTS(boolean supportTS) {
        isSupportTS = supportTS;
    }

    /*    public List<Epg> getEpgs() {
        return epgs;
    }

    public void setEpgs(List<Epg> epgs) {
        this.epgs = epgs;
    }*/

    public String getAdUrl() {
        return adUrl;
    }

    public void setAdUrl(String adUrl) {
        this.adUrl = adUrl;
    }

    public String getVideoId() {
        return videoId;
    }

    public void setVideoId(String videoId) {
        this.videoId = videoId;
    }

    public void setTemplatedId(String templated_id) {
        this.templated_id = templated_id;
    }

    public void setInstanceId(String insatnce_id) {
        this.instance_id = insatnce_id;
    }


    public String getTemplatedId() {
        return templated_id;
    }

    public String getInstanceId() {
        return instance_id;
    }


    public String getChannelCategory() {
        return channelCategory;
    }

    public void setChannelCategory(String channelCategory) {
        this.channelCategory = channelCategory;
    }


    public String getIsVideo() {
        return isVideo;
    }

    public void setIsVideo(String isVideo) {
        this.isVideo = isVideo;
    }

    public String getMedia_id() {
        return media_id;
    }

    public void setMedia_id(String media_id) {
        this.media_id = media_id;
    }

    public DvbBean getDvb() {

        return dvb;
    }

    public void setDvb(DvbBean dvb) {
        this.dvb = dvb;

    }

    public ProgramUnit getPresentProgram() {
        return presentProgram;
    }

    public void setPresentProgram(ProgramUnit presentProgram) {
        this.presentProgram = presentProgram;
    }

    public ProgramUnit getFollowingProgram() {
        return followingProgram;
    }

    public void setFollowingProgram(ProgramUnit followingProgram) {
        this.followingProgram = followingProgram;
    }

    public void startRecordTime() {
        startPlayTime = System.currentTimeMillis();
    }

    public void endRecordTime() {
        endPlayTime = System.currentTimeMillis();
    }

    /**
     * 单位为秒
     *
     * @return 秒
     */
    public int getRecordTime() {
        if(startPlayTime == 0 || startPlayTime > endPlayTime || endPlayTime == 0){
            return 0;
        }
        return (int) ((endPlayTime - startPlayTime) / 1000);
    }

    public String getLogoUrl() {
        return logoUrl;
    }

    public void setLogoUrl(String logoUrl) {
        this.logoUrl = logoUrl;
    }

    public String getBackground() {
        return background;
    }

    public void setBackground(String background) {
        this.background = background;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }


    public boolean isCanPlay() {
        return isCanPlay;
    }

    public void setCanPlay(boolean canPlay) {
        isCanPlay = canPlay;
    }

    public String getVideoType() {
        return videoType;
    }

    public void setVideoType(String videoType) {
        this.videoType = videoType;
    }

    @Override
    public String toString() {
        return "VideoBean{" +
                "channelNum='" + channelNum + '\'' +
                ", channelName='" + channelName + '\'' +
                ", duration=" + duration +
                '}';
    }
}
